import 'package:flutter/material.dart';

class ImgButton extends StatelessWidget {
  final VoidCallback onTap;
  final String assetName;
  final width;
  final height;
  final _disableOpacity = 0.5;
  const ImgButton(this.assetName,
      {Key key, this.onTap, this.width, this.height})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return onTap != null
        ? GestureDetector(
            onTap: onTap,
            child: Image.asset(assetName, width: width, height: height),
          )
        : Opacity(
            opacity: _disableOpacity,
            child: Image.asset(assetName, width: width, height: height),
          );
    ;
  }
}
